package com.chiry.business.until;

import java.io.File;

/**
 * @author fyx
 * @version 1.0
 * @date 2021/8/17 15:42
 */
public class FileUtil {
    public static String filePath = "";
    public static Long modifyTime = (long)0;

    public static String printRecentFile(File file) {
        if (file != null) {
            if (file.isDirectory()) {
                File[] files = file.listFiles();
                if (files != null) {
                    for (int i = 0; i < files.length; i++) {
                        printRecentFile(files[i]);  //递归判断
                    }
                }
            }else {
                String tempfilePath =file.getAbsolutePath();
                modifyTime = file.lastModified();
                filePath = tempfilePath;
                return filePath;
            }
        }
        return filePath;
    }
}
